package com.sixth.system.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.sixth.core.annotation.OperaLog;
import com.sixth.core.entity.RegisteredItem;
import com.sixth.core.vo.R;
import com.sixth.system.service.RegisteredItemService;
import com.sixth.system.vo.RegisteredItemVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 挂号费用设置控制器
 *
 * @author Stu YH
 * @date Created in 2024/8/20 20:19
 * @description 提供挂号费用相关的API接口
 * @modified By：
 * @version:
 */
@Api(tags = "挂号费用设置")
@RestController
@RequestMapping("system/registeredItem")
public class RegisteredItemController {
    @Autowired
    private RegisteredItemService registeredItemService;

    /**
     * 分页查询挂号费用
     * @param registeredItemVo 查询条件
     * @return 分页查询结果
     */
    @ApiOperation(value = "分页查询挂号费用", notes = "根据查询条件分页查询挂号费用列表")
    @RequestMapping("/listByPage")
    public R<IPage<RegisteredItem>> list(@RequestBody RegisteredItemVo registeredItemVo) {
        return registeredItemService.selectByPage(registeredItemVo);
    }

    /**
     * 添加或修改挂号费用
     * @param registeredItem 挂号费用信息
     * @return 操作结果
     */
    @ApiOperation(value = "添加或修改挂号费用", notes = "添加或修改挂号费用信息")
    @OperaLog(value = "添加或修改挂号费用", type = 2)
    @RequestMapping("/addUpdate")
    public R addUpdate(@RequestBody RegisteredItem registeredItem) {
        return registeredItemService.addUpdate(registeredItem);
    }

    /**
     * 删除挂号费用
     * @param registeredItemIds 挂号费用ID数组
     * @return 删除结果
     */
    @ApiOperation(value = "删除挂号费用", notes = "根据挂号费用ID数组删除挂号费用")
    @OperaLog(value = "删除挂号费用", type = 3)
    @DeleteMapping("/deletereg/{registeredItemIds}")
    public R deletereg(@PathVariable Long[] registeredItemIds) {
        return registeredItemService.deletereg(registeredItemIds);
    }
}
